//
// Created by 11510 on 2024/6/11.
//
#include <iostream>
#include <math.h>
using namespace std;

class Point{
public:
    Point(int x, int y)
    : _ix(x), _iy(y){}

    /* 友元声明 */
    friend float distance(const Point & lhs, const Point & rhs);

private:
    int _ix;
    int _iy;
};

/**
 * 友元函数的普通形式
 * @param lhs
 * @param rhs
 * @return
 */
float distance(const Point& lhs, const Point& rhs){
    return sqrt(pow(lhs._iy - rhs._iy, 2) + pow(lhs._ix - rhs._ix, 2));
}



void test0(){
    Point pt1(0, 0);
    Point pt2(3, 4);

    cout << distance(pt1, pt2);
}

int main() {
    test0();
    return 0;
}